package de.teamgamma.cansat.groundstation.transmitting;

import de.teamgamma.cansat.groundstation.control.Controller;
import de.teamgamma.cansat.groundstation.options.OptionKeys;

public class TransmitOptions {
	
	private boolean sendToGroundstation;
	public static TransmitOptions instance;
	private Controller controller;
	
	private TransmitOptions() {
		buildController();
	}
	
	/**
	 * Gets the instance of this class
	 * @return instance of this class
	 */
	
	public static TransmitOptions getInstance() {
		if(instance == null) {
			instance = new TransmitOptions();
		}
		return instance;
	}
	
	/**
	 * @return if the data will send to the groundstation
	 */
	
	public boolean checkSendToGroundstation() {
		return sendToGroundstation;
	}
	
	/**
	 * Builds the actual instance of the Controller
	 */
	
	public void buildController() {
		controller = Controller.getInstance();
	}
	
	/**
	 * Sets the boolean if the data will send to the groundstation
	 * @param value if it should be send to the groundstation
	 */
	
	public void setSendToGroundstation(boolean value) {
		sendToGroundstation = value;
	}
	
	/**
	 * Checks if the option is choosen that the data will send to the smartphone
	 */
	
	public boolean checkSendToSmartphone() {
		if(controller.getOptions().getOptionValue(OptionKeys.STREAMDATATOSMARTPHONE).equals("1"))
			return true;
		return false;
	}
	
	/**
	 * Checks if the option is choosen that the data will send to the website
	 */
	
	public boolean checkSendToWebsite() {
		if(controller.getOptions().getOptionValue(OptionKeys.STREAMDATATOWEBSITE).equals("1"))
			return true;
		return false;
	}
}
